package cn.wikiflyer.beikang.act.cart.util;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout.LayoutParams;
import cn.wikiflyer.beikang.R;

/**
 * 支付结果弹出框
 */
public class AliPayPopWindow {
	
	private Context context;
	private Dialog dialog;
	
	public AliPayPopWindow(final Context context) {
		super();
		this.context = context;
        View view = LayoutInflater.from(context).inflate(R.layout.pop_alipay_lay, null);
        
        LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
				LayoutParams.MATCH_PARENT);
//		params.setMargins(10, 40, 10, 40);
		dialog = new Dialog(context);
		dialog.setContentView(view, params);
		dialog.getWindow().setBackgroundDrawableResource(
				android.R.color.transparent);
		dialog.setCancelable(true);
		dialog.setCanceledOnTouchOutside(true);
		dialog.findViewById(R.id.textView1).setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (dialog.isShowing()) {
					dialog.dismiss();
				}
			}
		});
		dialog.findViewById(R.id.textView2).setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (dialog.isShowing()) {
					dialog.dismiss();
				}
			}
		});
		
	}
	public void show(){
		dialog.show();
	}

}
